
grid = [12, 12, 6, 9]

area = 0
for i in range(0, len(grid)):
    tmp = 1
    for j in range(0, len(grid)):
        if j != i:
            tmp = tmp * grid[j]
    area += tmp

print(area)